package bean;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.renderable.ParameterBlock;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Enumeration;

import javax.imageio.ImageIO;
import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;

import com.oreilly.servlet.MultipartRequest;
import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;

import bean.FmBoardVo;
import bean.FmMyOracle;

public class FmBoardDTO {
	
	private FmBoardVo vo;
	private Connection conn;
	
	//페이지 관련 변수
	int listSize=5; //페이지당 표시되는 행수
	int blockSize=5; //한 블럭당 표시되는 페이지 수
	int totSize=0; //전체 게시물의 갯수
	int totPage=0; //전체 페이지 수
	int nowPage=1; //현재 페이지 
	int nowBlock=1;//현재 블럭
	int startNo=0; //리스트 목록의 시작 위치
	int endNo=0; //리스트 목록의 끝 위치
	int startPage=0; //현재 블럭에서 표시되는 시작 페이지 번호
	int endPage=0; //현재 블럭에서 표쇠되는 끝 페이지 번호
	int totBlock=0; //전체 블럭의 수
	
	String saveDir="C:/Users/이종기/Desktop/HTA/Java_workspace/FindMe/WebContent/BoardPhoto/";
//	String saveDir="F:/SemiProject_FindMe/findMe/WebContent/BoardPhoto/";
	
	public FmBoardDTO(){
		conn=new FmMyOracle().getConn();
	}
	

	public void page(){ // 페이지 관련 연산
		String sql="select count(*) cnt from fmboard"
				+ " where (content like ? or subject like ?)"
				+ " and kind like ? and locate like ? and gender like ?";
		try{
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setString(1, "%"+vo.getFind()+"%");
			pst.setString(2, "%"+vo.getFind()+"%");
			pst.setString(3, "%"+vo.getKindFind()+"%");
			pst.setString(4, "%"+vo.getLocateFind()+"%");
			pst.setString(5, "%"+vo.getGenderFind()+"%");
			
			
			
			ResultSet rs = pst.executeQuery();
			if(rs.next()){
				nowPage=vo.getNowPage();
				//출력할 행수
				totSize = rs.getInt("cnt");
				//전체 페이지 수
				totPage = (int)Math.ceil(totSize*1.0/listSize);
				//전체 블럭수
				totBlock=(int)Math.ceil(totPage*1.0/blockSize);
				//현재 블럭
				nowBlock = (int)Math.ceil(nowPage*1.0/blockSize);
				//페이지의 시작과 끝 번호
				endPage = nowBlock * blockSize;
				startPage = endPage - blockSize+1;
				//게시물의 시작번호와 끝 번호
				endNo = nowPage * listSize;
				startNo=endNo - listSize + 1;
				//endPage,endNo 보정값
				if(endPage>totPage) endPage=totPage;
				if(endNo>totSize) endNo=totSize;
			}
			
		}catch(Exception ex){ex.printStackTrace();}
	}
	
/*	public void pageMain(){ // 페이지 관련 연산
		String sql="select count(*) cnt from fmboard"
				+ " where (content like ? or subject like ?)"
				+ " and kind like ? and locate like ? and gender like ? and finish = '미분양' ";
		try{
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setString(1, "%"+vo.getFind()+"%");
			pst.setString(2, "%"+vo.getFind()+"%");
			pst.setString(3, "%"+vo.getKindFind()+"%");
			pst.setString(4, "%"+vo.getLocateFind()+"%");
			pst.setString(5, "%"+vo.getGenderFind()+"%");
			
			
			
			ResultSet rs = pst.executeQuery();
			if(rs.next()){
				nowPage=vo.getNowPage();
				//출력할 행수
				totSize = rs.getInt("cnt");
				//전체 페이지 수
				totPage = (int)Math.ceil(totSize*1.0/listSize);
				//전체 블럭수
				totBlock=(int)Math.ceil(totPage*1.0/blockSize);
				//현재 블럭
				nowBlock = (int)Math.ceil(nowPage*1.0/blockSize);
				//페이지의 시작과 끝 번호
				endPage = nowBlock * blockSize;
				startPage = endPage - blockSize+1;
				//게시물의 시작번호와 끝 번호
				endNo = nowPage * listSize;
				startNo=endNo - listSize + 1;
				//endPage,endNo 보정값
				if(endPage>totPage) endPage=totPage;
				if(endNo>totSize) endNo=totSize;
			}
			
		}catch(Exception ex){ex.printStackTrace();}
	}*/
	
	
	
	
	
	
	public ArrayList<FmBoardVo> select(){
		page();
		ArrayList<FmBoardVo> al=new ArrayList<FmBoardVo>();
		
		String sql = "select * from fmboard where grp in "
    +"    (select grp from"
      +"      (select rownum rn, a.* from"
        +"        (select * from fmboard where "
          +"          (content like ? or subject like ? )"
            +"        and kind like ? and locate like ? and gender like ?"
             +"   order by grp desc,deep"
             +"   )a"
         +"   )where rn between ? and ?"
+"        )order by grp desc,deep,rno  ";
		
		try{
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setString(1, "%"+vo.getFind()+"%");
			pst.setString(2, "%"+vo.getFind()+"%");
			pst.setString(3, "%"+vo.getKindFind()+"%");
			
			System.out.println("kind : "+vo.getKindFind());
			System.out.println("locate : "+vo.getLocateFind());
			System.out.println("gender : "+vo.getGenderFind());
			System.out.println("find : "+vo.getFind());
			
			
			pst.setString(4, "%"+vo.getLocateFind()+"%");
			pst.setString(5, "%"+vo.getGenderFind()+"%");
			pst.setInt(6, startNo);
			pst.setInt(7, endNo);
			
			
			ResultSet rs = pst.executeQuery();
			
			
			while(rs.next()){
				
				FmBoardVo v = new FmBoardVo(); 
				  
				v.setRno(rs.getInt("rno"));
				v.setKind(rs.getString("kind"));
				
				v.setPic(rs.getString("pic"));
				v.setAge(rs.getString("age"));
				v.setMoney(rs.getInt("money"));
				v.setGender(rs.getString("gender"));
				
				v.setLocate(rs.getString("locate"));
				v.setSubject(rs.getString("subject"));
				v.setContent(rs.getString("content"));
				v.setHits(rs.getInt("hits"));
				
				v.setFinish(rs.getString("finish"));
				v.setWdate(rs.getString("wdate"));
				v.setGrp(rs.getInt("grp"));
				v.setDeep(rs.getString("deep"));
				
				al.add(v);
				
			}
			
			rs.close();
			pst.close();
			
			
			
			conn.close();
		}catch(Exception ex){ex.printStackTrace();}
		
		return al;
	}
	
	
	public ArrayList<FmBoardVo> selectMain(){
		ArrayList<FmBoardVo> al=new ArrayList<FmBoardVo>();
		
		String sql = "select * from fmboard where rno in "
    +"    (select rno from"
      +"      (select rownum rn, a.* from"
        +"        (select * from fmboard where "
          +"          (content like ? or subject like ? )"
            +"        and kind like ? and locate like ? and gender like ? and finish = '미분양' "
             +"   order by grp desc,deep"
             +"   )a"
         +"   )where rn between 1 and 15"
+"        )order by grp desc,deep,rno  ";
		
		try{
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setString(1, "%"+vo.getFind()+"%");
			pst.setString(2, "%"+vo.getFind()+"%");
			pst.setString(3, "%"+vo.getKindFind()+"%");
			

			
			
			pst.setString(4, "%"+vo.getLocateFind()+"%");
			pst.setString(5, "%"+vo.getGenderFind()+"%");
			
			System.out.println("kind : "+vo.getKindFind());
			System.out.println("locate : "+vo.getLocateFind());
			System.out.println("gender : "+vo.getGenderFind());
			System.out.println("find : "+vo.getFind());
			
			ResultSet rs = pst.executeQuery();
			
			
			while(rs.next()){
				
				FmBoardVo v = new FmBoardVo(); 
				  
				v.setRno(rs.getInt("rno"));
				v.setKind(rs.getString("kind"));
				
				v.setPic(rs.getString("pic"));
				v.setAge(rs.getString("age"));
				v.setMoney(rs.getInt("money"));
				v.setGender(rs.getString("gender"));
				
				v.setLocate(rs.getString("locate"));
				v.setSubject(rs.getString("subject"));
				v.setContent(rs.getString("content"));
				v.setHits(rs.getInt("hits"));
				
				v.setFinish(rs.getString("finish"));
				v.setWdate(rs.getString("wdate"));
				v.setGrp(rs.getInt("grp"));
				v.setDeep(rs.getString("deep"));
				
				al.add(v);
				
			}
			
			rs.close();
			pst.close();
			
			
			
			conn.close();
		}catch(Exception ex){ex.printStackTrace();}
		
		return al;
	}
	
	
	
	
	public void cntHits(){
		
		try{
			String sql2 = " update fmboard set hits=hits+1 where rno=? ";
			PreparedStatement pst2 = conn.prepareStatement(sql2);
			pst2.setInt(1, vo.getRno());
			pst2.executeUpdate();
			
			pst2.close();
			
		}catch(Exception ex){ex.printStackTrace();}
		
	}
	
	public int maxrno(){
		int max=0;
		try{
			String sq = "select max(rno) a from fmboard";
			PreparedStatement pst2 =conn.prepareStatement(sq);
			ResultSet rs = pst2.executeQuery();
			if(rs.next()) max=rs.getInt("a");
			rs.close();
			pst2.close();
		System.out.println("maxrno:"+max);
		}catch(Exception ex){ex.printStackTrace();}
		
		
		return max;
	}
	
	public FmBoardVo selectOne(){
		FmBoardVo v= new FmBoardVo();
		String sql = "select * from fmboard where rno=?";
		int maxr=0;
		try{
			PreparedStatement pst = conn.prepareStatement(sql);
			
			if(vo.getRno()==0) maxr=maxrno();
			else maxr=vo.getRno();
			
			pst.setInt(1, maxr);
			ResultSet rs = pst.executeQuery();
			if(rs.next()){  
				v.setRno(rs.getInt("rno"));
				v.setKind(rs.getString("kind"));
				v.setAge(rs.getString("age"));
				v.setMoney(rs.getInt("money"));
				v.setGender(rs.getString("gender"));
				v.setLocate(rs.getString("locate"));
				v.setSubject(rs.getString("subject"));
				v.setContent(rs.getString("content"));
				v.setHits(rs.getInt("hits"));
				v.setFinish(rs.getString("finish"));
				v.setPic(rs.getString("pic"));
				v.setWdate(rs.getString("wdate"));
				v.setDeep(rs.getString("deep"));
				v.setMid(rs.getString("mid"));
				v.setPhone(rs.getString("phone"));
				
				System.out.println("rno : "+rs.getInt("rno"));
				System.out.println("wdate : "+rs.getString("wdate"));
				
			}
			rs.close();
			pst.close();
			conn.close();
			
			
		}catch(Exception ex){ex.printStackTrace();}
		
		return v;
	}
	
	
	public boolean delete(){
		boolean b = false;
		try{
			String sql = "delete from fmboard where grp=? ";
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setInt(1, vo.getRno());
			
			int n = pst.executeUpdate();
			if(n>0){
				
				b=true;
				File f4 = new File(saveDir+vo.getPic());
				if(f4.exists())f4.delete();
				File f2 = new File(saveDir+"sm_"+vo.getPic());
				if(f2.exists()) f2.delete();
			}
			
			pst.close();
			
			
		}catch(Exception ex){ex.printStackTrace();}
		return b;
	}
	
	public boolean repdelete(){
		boolean b = false;
		try{
			String sql = "delete from fmboard where rno=? ";
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setInt(1, vo.getRno());
			
			int n = pst.executeUpdate();
			if(n>0){
				
				b=true;
				
			}
			
			pst.close();
			conn.close();
		
			
		}catch(Exception ex){ex.printStackTrace();}
		return b;
	}
	
	
	public String phoneInput(String smid){
		String ph="";
		String sq = "select phone from fmmember where mid=?";
		
		try{
			PreparedStatement pst2 =conn.prepareStatement(sq);
			pst2.setString(1, smid);
			ResultSet rs2 = pst2.executeQuery();
			
			if(rs2.next()) {
				
				ph=rs2.getString("phone");
				
			}
			rs2.close();
			pst2.close();
		}catch(Exception ex){
			ex.printStackTrace();
		}
		
		return ph;
		
	}
	
	
	
	public boolean insert(String smid){
		String ph = phoneInput(smid);
		System.out.println("insert()");
		req();
		boolean b = false;
		
		
		try{
			String sql = "insert into fmboard(rno,kind,locate,gender,subject,age,money,content,hits,finish,wdate,prno,deep,grp,pic,mid,phone)"
					+ "values(fmboard_seq_rno.nextval,?,?,?,?,?,?,?,?,?,sysdate,fmboard_seq_rno.nextval,fmboard_seq_rno.nextval,fmboard_seq_rno.nextval,?,?,?)";
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setString(1, vo.getKind());
			pst.setString(2, vo.getLocate());
			pst.setString(3, vo.getGender());
			pst.setString(4, vo.getSubject());
			pst.setString(5, vo.getAge());
			pst.setInt(6, vo.getMoney());
			pst.setString(7, vo.getContent());
			pst.setInt(8, 0);
			pst.setString(9, "미분양");
			pst.setString(10, vo.getPic());
			pst.setString(11, smid);
			pst.setString(12, ph);
			
			
			int n = pst.executeUpdate();
			if(n>0) {
				b=true;				
			}
			
			pst.close();
			
			
		}catch(Exception ex){ex.printStackTrace();}
		return b;
	}
	
	public boolean modify(){
		if(vo.getRequest()!=null){
		req2();
		}
		System.out.println(vo.getRno());
		boolean b = false;
		try{
			String sql = "update fmboard set kind=?,locate=?,gender=?,"
					+ " subject=?, age=?, money=?,finish=?,content=?,pic=? where rno=?";
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setString(1, vo.getKind());
			pst.setString(2, vo.getLocate());
			pst.setString(3, vo.getGender());
			
			pst.setString(4, vo.getSubject());
			pst.setString(5, vo.getAge());
			pst.setInt(6, vo.getMoney());
			if(vo.getFinish()==null){
				pst.setString(7, "미분양");
			}else{
				pst.setString(7, vo.getFinish());
			}
			pst.setString(8, vo.getContent());
			if(vo.getPic()==null){
				if(vo.getPrepic().equals("null")){
				pst.setString(9, "");
				}else{
				pst.setString(9, vo.getPrepic());}
			}else{
				pst.setString(9, vo.getPic());
			}
			pst.setInt(10, vo.getRno());
			
			
			int n = pst.executeUpdate();
			if(n>0){
				b=true;
			}
			
			pst.close();
			conn.close();
		
			
		}catch(Exception ex){ex.printStackTrace();}
		return b;
	}
	
	
	
	public void req(){
		System.out.println("req()");
		MultipartRequest multi = null;
		try{
			int size = 1024*1024*10;
			String oriFile="";
			String sysFile="";
			multi=new MultipartRequest(vo.getRequest(),
										saveDir,
										size,
										"utf-8",
										new DefaultFileRenamePolicy());
			
			vo.setKind(multi.getParameter("kind"));
			
			vo.setAge(multi.getParameter("age"));
			vo.setMoney(Integer.parseInt(multi.getParameter("money")));
			vo.setGender(multi.getParameter("gender"));
			
			vo.setLocate(multi.getParameter("locate"));
			vo.setSubject(multi.getParameter("subject"));
			vo.setContent(multi.getParameter("content"));
			
			System.out.println("multi.getParameter(pic)"+multi.getParameter("pic"));
			
//			if(multi.getParameter("pic")!=null){
				Enumeration files = multi.getFileNames();
				String tempFile = (String)files.nextElement();
				
				oriFile = multi.getOriginalFileName(tempFile);
				sysFile = multi.getFilesystemName(tempFile);
				
				vo.setPic(sysFile);
				System.out.println("DTO req()의 sysFile : " + sysFile);
				
				if(sysFile!=null){
				//섬네일 파일 추가 생성
				ParameterBlock pd = new ParameterBlock();
				pd.add(saveDir+sysFile);
				RenderedOp rop = JAI.create("fileload", pd);
				
				BufferedImage bi = rop.getAsBufferedImage();
				BufferedImage thumb = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
				Graphics2D  g = thumb.createGraphics();
				g.drawImage(bi, 0, 0, 100, 100, null);
				
				File file = new File(saveDir+"sm_"+sysFile);
				ImageIO.write(thumb, "jpg", file);
			
			}
			
			
		}catch(Exception ex){ex.printStackTrace();}
	}
	
	//수정용 request분해, 파일 생성 및 삭제
	public void req2(){
		
		MultipartRequest multi = null;
		try{
			int size = 1024*1024*10;
			String oriFile="";
			String sysFile="";
			multi=new MultipartRequest(vo.getRequest(),
										saveDir,
										size,
										"utf-8",
										new DefaultFileRenamePolicy());
			Enumeration files = multi.getFileNames();
			String tempFile = (String)files.nextElement();
			
			oriFile = multi.getOriginalFileName(tempFile);
			sysFile = multi.getFilesystemName(tempFile);
			
			vo.setRno(Integer.parseInt(multi.getParameter("rno")));
			vo.setKind(multi.getParameter("kind"));
			vo.setMid(multi.getParameter("mid"));
			vo.setPic(sysFile);
			vo.setAge(multi.getParameter("age"));
			vo.setMoney(Integer.parseInt(multi.getParameter("money")));
			vo.setGender(multi.getParameter("gender"));
			
			vo.setLocate(multi.getParameter("locate"));
			vo.setSubject(multi.getParameter("subject"));
			vo.setContent(multi.getParameter("content"));
			
			vo.setWdate(multi.getParameter("wdate"));
			vo.setFinish(multi.getParameter("finish"));
			
			vo.setPrepic(multi.getParameter("prepic"));
			
			vo.setNowPage(Integer.parseInt(multi.getParameter("nowPage")));
			vo.setKindFind(multi.getParameter("kindFind"));
			vo.setLocateFind(multi.getParameter("locateFind"));
			vo.setGenderFind(multi.getParameter("genderFind"));
			vo.setFind(multi.getParameter("find"));
			
			
			
			if(sysFile!=null){
			//섬네일 파일 추가 생성
			ParameterBlock pd = new ParameterBlock();
			pd.add(saveDir+sysFile);
			RenderedOp rop = JAI.create("fileload", pd);
			
			BufferedImage bi = rop.getAsBufferedImage();
			BufferedImage thumb = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
			Graphics2D  g = thumb.createGraphics();
			g.drawImage(bi, 0, 0, 100, 100, null);
			
			File file = new File(saveDir+"sm_"+sysFile);
			ImageIO.write(thumb, "jpg", file);
			}
			
			if(vo.getPrepic().equals("null"))
			{
				System.out.println("파일이 없다");
			}
			else
			{	
				System.out.println("파일있다!!");
				File f = new File(saveDir+vo.getPrepic());
				System.out.println("f는 "+saveDir+vo.getPrepic());
				File f2 = new File(saveDir+"sm_"+vo.getPrepic());
				System.out.println("f2는 "+saveDir+"sm_"+vo.getPrepic());
				if(f.exists()) {System.out.println("f있다.");f.delete();}
				if(f2.exists()) f2.delete();
				
			}
			
		}catch(Exception ex){ex.printStackTrace();}
	}
	
	
	
	
	public boolean repinput(int prno){
		boolean b = false;
		int maxrno =0;
		String ph=phoneInput(vo.getMid());
		try{
			String sq = "select max(rno) from fmboard";
			PreparedStatement pst2 =conn.prepareStatement(sq);
			ResultSet rs = pst2.executeQuery();
			if(rs.next()) maxrno=rs.getInt(1)+1;
			rs.close();
			pst2.close();
			
			String sql = "insert into fmboard(rno,subject,content,hits,wdate,prno,grp,deep,mid,phone)"
					+ "values(fmboard_seq_rno.nextval,?,?,?,sysdate,?,?,?,?,?)";
			PreparedStatement pst = conn.prepareStatement(sql);
			
			System.out.println("vo.getdeep은"+vo.getDeep());
			System.out.println("prno는"+prno);
			
			String g[] = vo.getDeep().split("-");
			pst.setString(5, g[0]);
			
			pst.setString(1, vo.getSubject());
			pst.setString(2, vo.getContent());
			pst.setInt(3, 0);
			pst.setInt(4, prno);
			
			System.out.println("prno : "+prno);
			System.out.println("maxrno : "+maxrno);
			
			
			pst.setString(6, vo.getDeep()+"-"+maxrno);
			pst.setString(7, vo.getMid());
			pst.setString(8, ph);
			
			int n = pst.executeUpdate();
			if(n>0)  b=true;
			
			pst.close();
		
			
		}catch(Exception ex){ex.printStackTrace();}
		return b;
		
		
	}
	
	
	
	public ArrayList<FmBoardVo> sublist(){
		ArrayList<FmBoardVo> subal = new ArrayList<FmBoardVo>();
		
		String sql = "select * from( select * from fmboard where rno in ((select max(grp)  from fmboard where grp <(select max(grp)  from fmboard where grp < (select grp from fmboard where rno = ? ))),(select max(grp)  from fmboard where grp < (select grp from fmboard where rno = ? ))) union select * from fmboard where grp = (select grp from fmboard where rno = ?) union select * from fmboard where rno in ((select min(grp)  from fmboard where grp >(select min(grp)  from fmboard where grp > (select grp from fmboard where rno = ? ))),(select min(grp)  from fmboard where grp > (select grp from fmboard where rno = ? ))))order by grp desc,rno";
		try{
			PreparedStatement pst = conn.prepareStatement(sql);
			pst.setInt(1, vo.getRno());
			pst.setInt(2, vo.getRno());
			pst.setInt(3, vo.getRno());
			pst.setInt(4, vo.getRno());
			pst.setInt(5, vo.getRno());
			ResultSet rs = pst.executeQuery();
			
			while(rs.next()){
				FmBoardVo v = new FmBoardVo();
				
				  
				v.setRno(rs.getInt("rno"));
				v.setKind(rs.getString("kind"));
				
				v.setPic(rs.getString("pic"));
				v.setAge(rs.getString("age"));
				v.setMoney(rs.getInt("money"));
				v.setGender(rs.getString("gender"));
				
				v.setLocate(rs.getString("locate"));
				v.setSubject(rs.getString("subject"));
				v.setContent(rs.getString("content"));
				v.setHits(rs.getInt("hits"));
				
				v.setFinish(rs.getString("finish"));
				v.setWdate(rs.getString("wdate"));
				v.setGrp(rs.getInt("grp"));
				v.setDeep(rs.getString("deep"));
				
				subal.add(v);
			}
			
		}catch(Exception ex){ex.printStackTrace();}
		
		
		return subal;
	}
	
	
	
	
	
	
	
	
	
	
	
	public FmBoardVo getVo() {
		return vo;
	}
	public void setVo(FmBoardVo vo) {
		this.vo = vo;
	}
	public Connection getConn() {
		return conn;
	}
	public void setConn(Connection conn) {
		this.conn = conn;
	}


	public int getListSize() {
		return listSize;
	}


	public void setListSize(int listSize) {
		this.listSize = listSize;
	}


	public int getBlockSize() {
		return blockSize;
	}


	public void setBlockSize(int blockSize) {
		this.blockSize = blockSize;
	}


	public int getTotSize() {
		return totSize;
	}


	public void setTotSize(int totSize) {
		this.totSize = totSize;
	}


	public int getTotPage() {
		return totPage;
	}


	public void setTotPage(int totPage) {
		this.totPage = totPage;
	}


	public int getNowPage() {
		return nowPage;
	}


	public void setNowPage(int nowPage) {
		this.nowPage = nowPage;
	}


	public int getNowBlock() {
		return nowBlock;
	}


	public void setNowBlock(int nowBlock) {
		this.nowBlock = nowBlock;
	}


	public int getStartNo() {
		return startNo;
	}


	public void setStartNo(int startNo) {
		this.startNo = startNo;
	}


	public int getEndNo() {
		return endNo;
	}


	public void setEndNo(int endNo) {
		this.endNo = endNo;
	}


	public int getStartPage() {
		return startPage;
	}


	public void setStartPage(int startPage) {
		this.startPage = startPage;
	}


	public int getEndPage() {
		return endPage;
	}


	public void setEndPage(int endPage) {
		this.endPage = endPage;
	}


	public int getTotBlock() {
		return totBlock;
	}


	public void setTotBlock(int totBlock) {
		this.totBlock = totBlock;
	}
	
	
	
	
	

}
